css value: No need for atomic refcounting
authorMatthias Clasen <mclasen@redhat.com>
Fri, 11 Sep 2015 23:04:54 +0000 (19:04 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 12 Sep 2015 16:50:38 +0000 (12:50 -0400)
We are all in one thread anyway.

gtk/gtkcssvalue.c
gtk/gtkcssvalueprivate.h

index ce2315c280bece0ac1e2d29eeecc393eda02391b..7f43e3f9f5d6464659641680669544af0adb2dd1 100644 (file)
@@ -48,7 +48,7 @@ _gtk_css_value_ref (GtkCssValue *value)
 {
   gtk_internal_return_val_if_fail (value != NULL, NULL);
 
-  g_atomic_int_add (&value->ref_count, 1);
+  value->ref_count += 1;
 
   return value;
 }
@@ -59,7 +59,8 @@ _gtk_css_value_unref (GtkCssValue *value)
   if (value == NULL)
     return;
 
-  if (!g_atomic_int_dec_and_test (&value->ref_count))
+  value->ref_count -= 1;
+  if (value->ref_count > 0)
     return;
 
   value->class->free (value);
index 6a5ab7005878c68b4856d64729407e3c018808f8..77dc5c9e042f1f794f737afc9854434f8f0d9c13 100644 (file)
@@ -35,7 +35,7 @@ typedef struct _GtkCssValueClass      GtkCssValueClass;
 /* using define instead of struct here so compilers get the packing right */
 #define GTK_CSS_VALUE_BASE \
   const GtkCssValueClass *class; \
-  volatile gint ref_count;
+  gint ref_count;
 
 struct _GtkCssValueClass {
   void          (* free)                              (GtkCssValue                *value);